<template>
    <div class="voucher">
        <el-row :gutter="10">
            <el-col :span="12">{{ $t('common.applyDate') }}：{{ data.applyTime | formatDate('yyyy-MM-dd hh:mm:ss') }}</el-col>
            <el-col :span="12">{{ $t('common.borrowingCycle') }}：{{ data.loanPeriod }}{{ $t('common.day') }}</el-col>
        </el-row>
        <el-row :gutter="10">
            <el-col :span="12">{{ $t('common.contractAmount') }}：{{ data.contractAmount | formatCurrency }}</el-col>
            <el-col :span="12">{{ $t('common.loanAmount') }}：{{ data.loanAmount | formatCurrency }}</el-col>
        </el-row>
        <el-row :gutter="10">
            <el-col :span="12">{{ $t('common.loanSerialNumber') }}：{{ data.controlNumber }}</el-col>
            <el-col :span="12">{{ $t('common.loanTime') }}：{{ data.loanTime | formatDate('yyyy-MM-dd hh:mm:ss') }}</el-col>
        </el-row>
        <el-row :gutter="10">
            <el-col :span="12">{{ $t('common.receiptAccount') }}：{{ data.withdrawAccount }}</el-col>
            <el-col :span="12">{{ $t('common.getTime') }}：{{ data.loanCompletionTime | formatDate('yyyy-MM-dd hh:mm:ss') }}</el-col>
        </el-row>
        <el-row :gutter="10">
            <el-col :span="12">{{ $t('common.loanType') }}：{{ data.withdrawChannel | SwitchLoanChannel }}</el-col>
            <el-col :span="12" v-if="data.withdrawChannel != 5 && data.withdrawChannel != 6 && data.withdrawChannel != 7">{{ $t('common.cashWithdrawalTime') }}：<span v-if="data.withdrawTime">{{ data.withdrawTime | formatDate('yyyy-MM-dd hh:mm:ss') }}</span><span v-else>{{ $t('common.waitWithdraw') }}</span></el-col>
        </el-row>
    </div>
</template>

<script>
    export default {
        name: 'voucher',
        props: {
            orderId: {
                type: String,
                default: ''
            },
        },
        data() {
            return {
                data: {}
            };
        },
        methods: {
            getData() {
                const params = {
                    orderId: this.orderId,
                    page: {
                        pageNo: 1,
                        pageSize: 10000
                    }
                };
                this.$api.finance.loan.successList(params).then(res => {
                    const {status, data, error} = res;
                    if ('1' === status && '00000000' === error && data) {
                        this.data = data.resultData[0];
                    }
                });
            }
        },
        created() {
            this.getData();
        }
    }
</script>
<style lang="scss" scoped>
    .voucher {
        .el-row {
            line-height: 40px;
        }
    }
</style>

